package com.usian.admin.controller.v1;

import com.usian.admin.service.AdSensitiveService;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.PathParam;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements com.usian.api.admin.AdSensitiveControllerApi {
   @Autowired
   private AdSensitiveService adSensitiveService ;

   @PostMapping("/list")
    @Override
    public ResponseResult findByName(@RequestBody SensitiveDto dto) {
        return adSensitiveService.findByName(dto);
    }

    @PostMapping("/save")
    @Override
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    @PostMapping("/update")
    @Override
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }
    @GetMapping("/del/{id}")
    @Override
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }
}
